<?php

namespace app\api\logic;

use app\common\basic\BasicLogic;
use app\common\model\UsersModel;
class UserLogic extends BasicLogic
{
    protected $model;
    public function __construct()
    {
        $this->model = new UsersModel();
    }

    public function getUserInfo($id)
    {
        // 获取用户信息及其角色
        $user = $this->model->field('id,account') ->find($id);
        if (!$user) {
            return ['error' => true, 'msg' => '用户不存在'];
        }
        // 返回用户信息、角色和菜单树
        return
            ['error' => false, 'data' => $user->toArray(),];
    }
    
}